package ru.rchervot.sanasar.client.view;

import ru.rchervot.sanasar.client.place.Place;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerManager;

public abstract class AbstractModuleHeaderSearchPresenter extends AbstractModuleHeaderPresenter {

	public interface Display extends AbstractModuleHeaderPresenter.Display {
		public HasClickHandlers getNewCardButton();
  }	
	
	public AbstractModuleHeaderSearchPresenter(Display display, final HandlerManager eventBus) {
		super(display, eventBus);
	}
		
	protected abstract GwtEvent<?> getNewRecordEvent();
	
	@Override
	public void bindDisplay() {
		super.bindDisplay();
		
		((AbstractModuleHeaderSearchPresenter.Display)getDisplay()).getNewCardButton().addClickHandler(new ClickHandler() {
			@Override
			public void onClick(ClickEvent event) {
				eventBus.fireEvent(getNewRecordEvent());
			}
		});
	}
	
	@Override
	public void go(Place place) {
		// TODO Auto-generated method stub
		
	}

}
